import React, { Component } from 'react'
import RouterView from '../../router/RouterView';
import {NavLink} from "react-router-dom"
import { Modal, Button } from 'antd';
export class Home extends Component {
    // const [isModalVisible, setIsModalVisible] = useState(false);
    state={
        isModalVisible:false
    }
    showModal (){
        // setIsModalVisible(true);
        this.setState({isModalVisible:true})
    };
    // const showModal = () => {
    //     setIsModalVisible(true);
    //   };
    
    handleOk ()  {
        // setIsModalVisible(false);
        this.setState({isModalVisible:false})
    };
    
    handleCancel () {
        // setIsModalVisible(false);
        this.setState({isModalVisible:false})
    };
    render() {
        let {routes} = this.props
        let {isModalVisible} = this.state
        return (
            <div>
                主页

                <RouterView routes={routes}/>
                <div>
                    <NavLink to="/index/home/left">左</NavLink>
                    <NavLink to="/index/home/center">中</NavLink>
                    <NavLink to="/index/home/right">右</NavLink>
                </div>
                <Button type="primary" onClick={this.showModal.bind(this)}>
                    Open Modal
                </Button>
                <Modal title="张三和李四" 
                    visible={isModalVisible} 
                    onOk={this.handleOk.bind(this)} 
                    onCancel={this.handleCancel.bind(this)}
                    >
                   
                   11111111111111111111111
                </Modal>
            </div>
        )
    }
}

export default Home
